package org.siberia.server.converter;

import org.siberia.client.bean.ActionSuiteDTO;
import org.siberia.client.bean.UserDTO;
import org.siberia.server.model.ActionSuite;
import org.siberia.server.model.User;

public class ActionSuiteConverter
{
	public static ActionSuiteDTO convert(ActionSuite _suite)
	{
		ActionSuiteDTO suite = null;
		
		if ( _suite != null )
		{
			suite = new ActionSuiteDTO();
			
			suite.id = _suite.id;
			suite.name = _suite.name;
			suite.description = _suite.description;
			
			UserDTO user = null;
			if ( _suite.ownerKey != null )
			{
				user = UserConverter.convert(_suite.getUser());
			}
			suite.owner = user;
		}
		
		return suite;
	}
	
	public static ActionSuite convert(ActionSuiteDTO _suite)
	{
		ActionSuite suite = null;
		
		if ( _suite != null )
		{
			suite = new ActionSuite();
			
			suite.id = _suite.id;
			suite.name = _suite.name;
			suite.description = _suite.description;
			suite.ownerKey = (_suite.owner == null ? null : _suite.owner.id);
		}
		
		return suite;
	}
}
